// 针对所需要针对兼容的浏览器进行适配需要引入这两个包
import "core-js/stable";
import "regenerator-runtime/runtime"

import {
  sum,
  square
} from './js/utils.js'
import './js/image.js';
import './js/Font.js';
import './js/title';
import tsTest from './js/ts.ts';
const getInfo = require('./js/api.js')
import './js/login'

import _ from 'lodash';
import {
  foofoofoo
} from "./js/unUsed.js";
import { foo1 } from '../package_library/sy_utils'

import('./js/dynamicImport.js')

if (module.hot) {
  module.hot.accept(
    ['./js/title.js'],
    () => {
      console.log('热替换')
    }
  )
}
foofoofoo(1, 1)
console.log(sum(10, 20))
console.log(square(10))
console.log(getInfo())
console.log(BASE_URL, typeof A, typeof B)

console.log('foo1 library', foo1)


const p = new Promise((resolve) => {
  resolve('111');
});

p.then(val => {
  console.log(val);
})


const test = async () => {
  await 1
  await 2
};

test().catch(err => {
  console.log(err)
})

tsTest('11')

/** 按需加载 **/
const oBtn = document.createElement('button')
oBtn.innerHTML = '点击加载元素'
document.body.appendChild(oBtn)

// 按需加载
oBtn.addEventListener('click', () => {
  import('./js/lazy').then(({
    default: element
  }) => {
    console.log(element)
    document.body.appendChild(element)
  })
});

console.log('isEqual正常运行', _.isEqual(1, 1));

// 01 为什么需要loader
// 需要webpack处理一些非js文件时，需要进行转换。
// 02 loader是什么 
// 模块
// 03 css-loader